# 创建一个注册页面类
import allure
from selenium.webdriver.common.by import By

from base.base import Base


class PageRegister(Base):
    #输入手机号
    @allure.step("1、输入手机号")
    def __page_input_phone(self,username):
        self.element_send_keys((By.CSS_SELECTOR,'#username'),username)
    #输入验证码
    @allure.step("2、输入验证码")
    def __page_input_code(self,code):
        self.element_send_keys((By.CSS_SELECTOR,"input[placeholder='图像验证码']"),code)
    #输入密码
    @allure.step("3、输入密码")
    def __page_input_password(self,password):
        self.element_send_keys((By.CSS_SELECTOR,"#password"),password)
    #输入确认密码
    @allure.step("4、输入确认密码")
    def __page_input_password2(self,password2):
        self.element_send_keys((By.CSS_SELECTOR,"#password2"),password2)
    #点击注册按钮
    @allure.step("5、点击注册按钮")
    def __page_click_register_btn(self):
        self.element_click((By.CSS_SELECTOR,".regbtn.J_btn_agree"))
    #整合注册方法
    def page_register(self,username,code,password,password2):
        self.__page_input_phone(username)
        self.__page_input_code(code)
        self.__page_input_password(password)
        self.__page_input_password2(password2)
        self.__page_click_register_btn()




